#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cstring>
using namespace std;
const int MAXN=1e7+7;
typedef long long ll;
int prime[MAXN], p_cnt, mu[MAXN];
bool is_prime[MAXN];
ll sum[MAXN],su[MAXN];
void Eler() {
	memset(is_prime, 1, sizeof(is_prime));
	mu[1]=1; p_cnt=0; sum[1]=0;
	for (int i=2; i<MAXN; ++i) {
		if (is_prime[i]) {
			mu[i]=-1;
			prime[p_cnt++]=i;
			sum[i]=1;
		}
		for (int j=0; j<p_cnt&&i*prime[j]<MAXN; ++j) {
			is_prime[i*prime[j]]=false;
			if (i%prime[j]==0) {
				mu[i*prime[j]]=0;
				sum[i*prime[j]]=mu[i];
				break;
			}
			else {
				mu[i*prime[j]]=-mu[i];
				sum[i*prime[j]]=mu[i]-sum[i];
			}
		}
	}
	su[0]=0;
	for (int i=1; i<MAXN; ++i) su[i]=su[i-1]+sum[i];
}
int main() {
	Eler();
	ll n,last;
	cin>>n;
	ll res=0;
	for (ll i=1; i<=n; i=last+1) {
		last=n/(n/i);
		res+=(su[last]-su[i-1])*(n/i)*(n/i);
	}
//	for (int i=1; i<=n; ++i) {
//		res+=sum[i]*(n/i)*(n/i);
//	}
	cout<<res<<endl;
	return 0;
} 
